import api from '../api/index.js'
import {
	mapState
} from 'vuex'

export const mixins = {
	data() {
		return {

		}
	},
	computed: mapState([
		// 映射 this.count 为 store.state.count
		'userInfo'
	]),
	methods: {
		// formate(imgUrl) {
		// 	return api.baseUrl() + imgUrl.substr(imgUrl.indexOf('*') + 1, imgUrl.length - 1);
		// 	// return imgUrl.substr(imgUrl.indexOf('*') + 1, imgUrl.length - 1);
		// },
		checkToken(){
			if(uni.getStorageSync("token")){
				return true
			}
			return false
		},
		toLogin(){
			uni.showModal({
				content:"请登录",
				success(res) {
					if(res.confirm){
						uni.redirectTo({
							url: '../auth/index'
						});
					}
				}
			})
		},
	}
}
